package com.jsb.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jsb.mapper.PurchaseOrderMapper;
import com.jsb.model.PurchaseOrder;
import com.jsb.model.PurchaseOrderExample;

@Service
public class PurchaseOrderService{
	
	@Resource
	private PurchaseOrderMapper purchaseOrderMapper;
	
	public void addPurchaseOrder(PurchaseOrder purchaseOrder) {
		purchaseOrderMapper.insertSelective(purchaseOrder);
	}
	
	public void delPurchaseOrderByUuid(String uuid) {
		purchaseOrderMapper.deleteByPrimaryKey(uuid);
	}
	
	public void updatePurchaseOrder(PurchaseOrder purchaseOrder) {
		purchaseOrderMapper.updateByPrimaryKeySelective(purchaseOrder);
	}
	
	public void updatePurchaseOrderByExample(PurchaseOrder purchaseOrder,PurchaseOrderExample purchaseOrderExample){
	    purchaseOrderMapper.updateByExampleSelective(purchaseOrder,purchaseOrderExample);
	}
	
	public PurchaseOrder getPurchaseOrderByUuid(String uuid) {
		return purchaseOrderMapper.selectByPrimaryKey(uuid);
	}
	
	public List<PurchaseOrder> getPagePurchaseOrder(PurchaseOrderExample purchaseOrderExample) {
		return purchaseOrderMapper.selectPage(purchaseOrderExample);
	}
	
	public int countPurchaseOrder(PurchaseOrderExample purchaseOrderExample) {
		return purchaseOrderMapper.countByExample(purchaseOrderExample);
	}
	
	public List<PurchaseOrder> selectByExample(PurchaseOrderExample example){
	    return purchaseOrderMapper.selectByExample(example);
	}
}
